<!doctype html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>缤格</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/swiper.min.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/common.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/binge.css"/>
    <script type="text/javascript" src="../../script/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="../../script/swiper.min.js"></script>
    <script type="text/javascript" src="../../script/laydate/laydate.js"></script>
    <script type="text/javascript" src="../../script/mobile.js"></script>
    <script type="text/javascript">
        window['adaptive'].desinWidth = 750;
        window['adaptive'].baseFont = 28;
        window['adaptive'].maxWidth = 750;
        window['adaptive'].init();
    </script>
</head>

<body>
<div id="header" style="height: 0.9rem; background: #fff; position: fixed; top: 0;left: 0; width: 100%; z-index: 99">
    <!-- header -->
    <div class="header">
        <div class="head-back">
            <a href="javascript:void(0);" tapmode onclick="comeBack()" class="back-btn"></a>
        </div>
        <div class="head-title">
            <h6>需求报名</h6>
        </div>
        <!--<div class="head-action">-->
        <!--<a href="javascript:void(0);" tapmode class="action-btn"></a>-->
        <!--</div>-->
    </div>
    <!-- header end -->
</div>

<div class="header-h" style="padding-top: 1.4rem;"></div>
<div class="sign-section">
    <ul id="inputList">
        <!--<li>
            <p class="label">姓名</p>
            <div class="label-item">
                <input type="text" placeholder="请输入姓名">
            </div>
        </li>
        <li>
            <p class="label">性别</p>
            <div class="label-item">
                <input type="text" readonly placeholder="请输入学校" value="男">
            </div>
        </li>
        <li>
            <p class="label">学校</p>
            <div class="label-item">
                <input type="text" readonly placeholder="请输入学校" value="重庆大学">
            </div>
        </li>
        <li>
            <p class="label">专业</p>
            <div class="label-item">
                <input type="text" readonly placeholder="请输入专业" value="经济学">
            </div>
        </li>
        <li>
            <p class="label">微信号</p>
            <div class="label-item">
                <input type="text" placeholder="请输入微信号">
            </div>
        </li>
        <li>
            <p class="label">QQ号</p>
            <div class="label-item">
                <input type="text" placeholder="请输入QQ号">
            </div>
        </li>-->

    </ul>

    <div class="common-fixed-bottom">
        <a href="javascript:void(0);" tapmode onclick="checkInfo()" class="fixed-bottom">确认报名</a>
    </div>
</div>


</body>

</html>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript">
    var activity_id = '';//活动id
    apiready = function () {

        setFixStatusBar(); //设置状态栏

        activity_id = api.pageParam.activity_id;
        pop.loading()
        keybackListener()
        //查询活动报名需要填写信息
        getSignInfo()


    };

    function checkInfo() {
        var information = '';
        $("#inputList input").each(function () {
            var _this = $(this);
            if (_this.val() == '') {
                pop.notice('请完善报名信息')
                return false;
            } else {
                if (information == '') {
                    information = _this.val()
                } else {
                    information += ',' + _this.val()
                }

            }
        });
        console.log(information)
        submitFrom(information)
    }

    function submitFrom(info) {
        var param = {
            token: $api.getStorage('token'),
            activity_id: activity_id,
            information: info,
        }
        console.log(jsonChange(param))
        pop.loading();
        getAjax(Interface.activity_up, param, function (res) {
            pop.notice(res.msg);
            pop.close();
            setTimeout(function () {
                comeBack();
                api.sendEvent({
                    name: 'signUped',
                    extra: {}
                });
            }, 1000)
        }, function (error) {
            pop.notice(error.msg)
            pop.close();
        })

    }

    //查询活动报名需要填写信息
    function getSignInfo() {
        var param = {
            token: $api.getStorage('token'),
            activity_id: activity_id,
        }
        getAjax(Interface.get_activity_information, param, function (res) {
            var data = res.data;
            var html = '';
            if (isDefine(data)) {
                for (var i = 0; i < data.length; i++) {
                    var label = '请输入' + data[i];
                    html += '<li>' +
                        '     <p class="label">' + data[i] + '</p>' +
                        '     <div class="label-item"><input type="text" placeholder="' + label + '"></div>' +
                        '</li>'
                }
                $("#inputList").html(html)
            } else {
                $("#inputList").html(noData)
            }
            pop.close()
        }, function (error) {
            pop.notice(error.msg);
            pop.close();
        })
    }


</script>
